package design.simdi.code.final_paper.utils;

import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.NavigationToolbar;
import org.apache.wicket.markup.html.panel.EmptyPanel;

import design.simdi.code.final_paper.core.entities.Domain;

/**
 * 
 * @author Marius Dumitriu - (Jun 18, 2010 - 5:57:37 PM)
 * 
 */
public class MyNavigationToolbar extends NavigationToolbar {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public MyNavigationToolbar(DataTable<?> table) {
		super(table);

		this.get("span:navigatorLabel").replaceWith(new EmptyPanel("navigatorLabel"));
		this.get("span").add(new SimpleAttributeModifier("colspan", "" + (getTable().getColumns().length - 1)));
	}

	@SuppressWarnings("unchecked")
	protected void onBeforeRender() {
		super.onBeforeRender();
		setVisible(true);
		((MyDataTable<Domain>) getTable()).setSelectedRow(null);
	}

}
